<?php

/**
 * model_department
 */

	class Model_department extends YOU {

	public function __construct()
	{
		parent::__construct();
	}

	/** 读取成配置 **/
	public function getIni()
	{
		$department_lists = $this->getAll();
		foreach ($department_lists as $key => $value){
			$department[$value['department_id']] = $value['department_name'];
		}

		return $department;
	}

	/** 读取列表 **/
	public function getAll($field = "*")
	{
		$department_lists = $this->db->fetchAll("SELECT {$field} FROM `tbl_department` ");

		return $department_lists;
	}

	/** 读取信息 **/
	public function getInfo($department_id, $field = "*")
	{
		$data = $this->db->fetchRow("SELECT {$field} FROM `tbl_department` WHERE department_id='{$department_id}' ");

		return $data;
	}
	/** 读取上级部门信息 **/
	public function getUpAll($field = "*")
	{
		$up_lists = $this->db->fetchAll("SELECT {$field} FROM `tbl_department_up`  ");

		return $up_lists;
	}
	/** 读取上级部门信息 **/
	public function getUpInfo($up_id, $field = "*")
	{
		$data = $this->db->fetchRow("SELECT {$field} FROM `tbl_department_up` WHERE up_id='{$up_id}' ");
		
		return $data;
	}

}



?>